using System;

namespace IBNet
{
   /// <summary>
   /// Used to manage the legs of a combination order. This class is immutable.
   /// </summary>
   public class ComboLeg
   {
      private readonly int contractId;
      private readonly ActionSide actionSide;      
      private readonly int ratio;
      private readonly string exchange;

      #region Constructors

      /// <summary>
      /// Creates a new ComboLeg.
      /// </summary>
      /// <param name="contractId">A unique contract identifier.</param>
      /// <param name="actionSide">The ActionSide for the combo leg (Buy or Sell).</param>
      /// <param name="ratio">The ratio.</param>
      /// <param name="exchange">The exchange to which the complete combination order will be routed.</param>
      public ComboLeg(int contractId, ActionSide actionSide, int ratio, string exchange)
      {
         this.contractId = contractId;
         this.actionSide = actionSide;
         this.ratio = ratio;
         this.exchange = exchange;
      }

      #endregion

      #region Properties

      /// <summary>
      /// Gets the unique contract identifier for this leg.
      /// </summary>
      public int ContractId { get { return contractId; } }

      /// <summary>
      /// Gets the ActionSide for this leg.
      /// </summary>
      public ActionSide ActionSide { get { return actionSide; } }

      /// <summary>
      /// Gets the ratio for this leg.
      /// </summary>
      public int Ratio { get { return ratio; } }

      /// <summary>
      /// Gets the exchange to which the complete combination order will be routed.
      /// </summary>
      public string Exchange { get { return exchange; } }

      #endregion
   }
}